{include file="news/header.tpl"}
<script type="text/javascript"
	src="/static/public/ztree/jquery.ztree.core-3.3.js"></script>
		<script type="text/javascript" src="/static/public/ztree/jquery.ztree.excheck-3.3.js"></script>
	
		<script type="text/javascript" src="/static/public/ztree/jquery.ztree.exedit-3.3.js"></script>
	<link rel="stylesheet"
	href="/static/public/ztree/css/zTreeStyle/zTreeStyle.css"
	type="text/css">
 {literal}
<script type="text/javascript">
$(document).ready(function() { 
	$("#chk_all").click( 
		 function(){ 
			if(this.checked){ 
			 $("input[name='chk_list']").attr('checked', true) 
			 }else{ 
			$("input[name='chk_list']").attr('checked', false) 
			} 
			} 
			);
   $.fn.zTree.init($("#treeDemo"), setting, zNodes);
  
          });   


    
 

function act(name){

 var arrChk=$("input[name='chk_list']:checked");
	 var ids='';
	 var cid=$("input[name='category']").val(); 

if(name=='search'){
window.location.href='/news/listing/?type=manage&cid='+cid;         
return false;
}

 
 var flag=confirm('确认操作?');
 
 if(flag==false){
     return false;
 }

 $(arrChk).each(function(){
	     ids=ids+','+this.value;                        
	  }); 

	 $.post("/news/copy",{ids:ids,cid:cid,type:name},function(data){
         alert(data.error);  
         window.location.href='/news/listing/?type=manage';
	 },"json");


}




var setting = {
	view: {
		dblClickExpand: false
	},
	 async: {
		enable: true,
		url:"/news/ztree",
		dataType: "json",
		autoParam:["id"],
		otherParam:{"otherParam":"zTreeAsyncTest"},
	},
	data: {
		simpleData: {
			enable: true,
			idKey:"id",
			pIdKey:"pid"
		}
	},
	callback: {
		beforeClick: beforeClick,
		onClick: onClick
	}
};

var zNodes ={/literal}{$ztree}{literal};

function beforeClick(treeId, treeNode) {
//var check = (treeNode && !treeNode.isParent);
//if (!check) alert("只能选择城市...");
//return check;
}

function onClick(e, treeId, treeNode) {
	var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
	nodes = zTree.getSelectedNodes(),
	v = "";
	nodes.sort(function compare(a,b){return a.id-b.id;});
	for (var i=0, l=nodes.length; i<l; i++) {
		v += nodes[i].name + ",";
	}
	if (v.length > 0 ) v = v.substring(0, v.length-1);
	var cityObj = $("#citySel");

	var id=v.match(/\d+/g);
	$("input[name='category']").val(id);
	cityObj.attr("value", v);
	hideMenu();
}

function showMenu() {
	var cityObj = $("#citySel");
	var cityOffset = $("#citySel").offset();
	$("#menuContent").slideDown("fast");

	$("body").bind("mousedown", onBodyDown);
}
function hideMenu() {
	$("#menuContent").fadeOut("fast");
	$("body").unbind("mousedown", onBodyDown);
}
function onBodyDown(event) {
	if (!(event.target.id == "menuBtn" || event.target.id == "menuContent" || $(event.target).parents("#menuContent").length>0)) {
		hideMenu();
	}
}   
function recyle(id){
      var  ids=","+id;
    if(confirm("确认删除")==true){
       
   	 $.post("/news/copy",{ids:ids,cid:1067,type:"move"},function(data){
       // alert("删除成功");
         $("#"+id).fadeOut();
	 },"json");
    }else{
      return false;
    }
}    
  
       
function sort(id){
var s=$("#sort"+id).val();

$.post("/news/s",{sort:s,id:id},function(data){
 alert(data);  
});
}    	       

</script>

{/literal}

</head>

<!-- 头部// -->
{include file="news/top.tpl"}


{include file="news/nav.tpl"}


	<!-- start: Content -->
			<div id="content" class="span12">
			
						
			<div class="row-fluid">


<div class="box span12"><!-- Default panel contents -->

<div class="box-header" data-original-title="">
						<h2><i class="icon-user"></i><span class="break"></span>内容列表</h2>
						<div class="box-icon">
							<a href="#" class="btn-setting"><i class="icon-wrench"></i></a>
							<a href="#" class="btn-minimize"><i class="icon-chevron-up"></i></a>
							<a href="#" class="btn-close"><i class="icon-remove"></i></a>
						</div>
					</div>

<div class="box-content">
<form class="form-inline" method="post" action="/news/search">
<div class="form-group">

<div class="checkbox"><label> <input type="checkbox" name="chk_all"
	id="chk_all" />全选 </label></div>
<input id="citySel" type="text" name="cate"
	value="{$category.name}{$category.id}"
	style="width: 100px;" onclick="showMenu(); return false;" />
<div id="menuContent" style="display:none;position: absolute;z-index:999">
<ul id="treeDemo" class="ztree"
	style="margin-top: 0; background-color: #FFF; border: 1px solid #ddd"></ul>
	</div>
</div>
<input type=button name=copy class="btn btn-primary" value="查询"
	onclick="act('search');"> <input type=button name=copy
	class="btn btn-primary" value="复制" onclick="act('copy');"> <input
	type=button name=move class="btn btn-primary" value="转移"
	onclick="act('move');"> <span class="glyphicon glyphicon-search"> <select
	name="key" class="form-control">
	<option value="title">标题</option>
	<option value="a.id">ID</option>
</select>
<div class="form-group"><input type="hidden" name="category"
	value="{$category.id}"> <input class="form-control" name="value"
	type="text"></div>
<button class="btn btn-primary" type="submit">搜索</button>

<a href="/news/listing/?type=manage&cid=1067&p=1"><span
	class="glyphicon glyphicon-trash"></span></a></div>
	
</form>
<table class="table table-striped table-hover">
<tr class=title><th>序号</th><th>状态</th><th>订单号</th><th>用户名</th><th>收货人</th><th>收货地址</th><th>手机</th><th>总价</th><th>时间</th><th>操作</th></tr>




{section name=l loop=$news }
<tr>
<td class=left width="7%" style="text-align:left;"><input type=checkbox name=chk_list value="{$news[l].id}" >{$news[l].id}</td>
<td class=left width="10%">{if $news[l].status==0}未付款{else}已付款{/if}</td>
<td class=left width="6%"><a href="#">{$news[l].orderno}</a></td>
<td class=left width="8%"><a href="#">{$news[l].username}</a></td>
<td class=right width="8%">{$news[l].country}{$news[l].shr}</td>
<td class=right width="18%"><a href="/news/v/?id={$news[l].nid}" target="__blank">{$news[l].address}</a></td>
<td class=left>{$news[l].mobile}</td>
<td class=right width="6%"><a href="#">{$news[l].total}</a></td>
<td class=left>{$news[l].addtime|date_format:"%m/%d %H:%I"}</td>
<td class=right width="10%"><a href="/order/i/?sno={$news[l].orderno}">查看</a></td>

</tr>
{/section}

</table>

</div>
<ul class="pagination" id="pager"></ul>

</div>




</div>

</div>
</div>
</div>

{literal}
<script type='text/javascript'>
var options = {
currentPage: {/literal}{$num.current}{literal},
totalPages: {/literal}{$num.page}{literal},
numberOfPages:5,
bootstrapMajorVersion:3,
pageUrl: function(type, page, current){
    return "/news/listing/?type=manage&cid={/literal}{$category.id}{literal}&p="+page;
}
}
$('#pager').bootstrapPaginator(options);
</script>
{/literal}

